//
//  UIColor-Random.m
//  QuartzFun
//
//  Created by KaiKai on 11-8-22.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import "UIColor-Random.h"

@implementation UIColor(Random)

- (id)init
{
    self = [super init];
    if (self) {
        // Initialization code here.
    }
    
    return self;
}

+(UIColor *)randomColor
{
	static BOOL seeded = NO;
	if (!seeded)
	{
		seeded = YES;
		srandom(time(NULL));
	}
	
	CGFloat red = (CGFloat)random() / (CGFloat)RAND_MAX;
	CGFloat blue = (CGFloat)random() / (CGFloat)RAND_MAX;
	CGFloat green = (CGFloat)random() / (CGFloat)RAND_MAX;
	
	return [UIColor colorWithRed:red green:green blue:blue alpha:1.0f];
}

@end
